
 struct TreeNode {
    int val;
    struct TreeNode *left;
    struct TreeNode *right;
 };
 

//翻转二叉树
struct TreeNode* invertTree(struct TreeNode* root){
    if(!root) return root;//==return NULL; root==NULL
    struct TreeNode* tmp=root->left;//交换节点，前序遍历
    root->left=root->right;
    root->right=tmp; 
    invertTree(root->left); //交换过的子树的两个节点再次交换
    invertTree(root->right);
    return root;
}